from pydantic import BaseModel
from typing import Optional

class PermissionBase(BaseModel):
    en_name: str
    name: str
    description: str
    type: str  # 自动校验枚举值

class PermissionCreate(PermissionBase):
    updater: Optional[int] = None

class PermissionUpdate(BaseModel):
    en_name: Optional[str] = None
    name: Optional[str] = None
    description: Optional[str] = None
    type: Optional[str] = None

    class Config:
        extra = "forbid"  # 禁止额外字段